
This entry contains replication code and intermediate data for "Quantifying bias from measurable and unmeasurable confounders across three domains of individual determinants of political preferences."


The code was executed on a machine running Windows Server 2019 (Intel i9-7900X CPU @ 3.3GHz, 10 cores, 128GB RAM), on Stata version 15.1. The code requires the package reghdfe (version 5.7.3). Total running time for all steps was 34 minutes. Running time for part 2 only was 1 minute 15 seconds.


A full description of each file can be found at the bottom of this document.

There are two ways of replication the results in the paper. The first is to obtain the raw individual level data from the various register sources used, while the second only requires the files provided in this directory (see below). The raw data is proprietary and cannot be shared by the authors but can be obtained from Statistics Sweden and the Swedish Twin Register following the requisite ethics approval and application procedure. To do this, the first step is to obtain permisson from a Swedish Ethical Review Board. The second step is to order the data from Statistics Sweden and the Swedish Twin Register. This also requires that at least one collaborator is based at a Swedish university. A complete description of the order procedure can be found on the following to pages: https://www.scb.se/en/services/guidance-for-researchers-and-universities/ and https://ki.se/en/research/swedish-twin-registry-for-researchers. The specific register and survey sources used in the paper are: the Multigeneration Register, the Census data (Folk och Bostadsräkningarna, FoB) for 1960 and 1970, the LISA databases for 1990-2010, and the wealth register from Statistics Sweden; the core cohort files, the SALTY survey and the SALT survey from the Swedish Twin Register; and conscription aptitude test data from Inskrivningsarkivet, Rekryteringsmyndigheten and the Swedish Twin Register.

Furthermore, the robustness checks involving election surveys from Denmark, Norway, Sweden and the UK require the micro-level datasets from these sources. The Danish election survey for 2007 can be downloaded following agreeing to the terms of use at https://www.sa.dk/en/the-danish-election-survey-1971-2019/. The Norwegian election dataset for 2009 can be ordered free of charge following a formal application at https://www.nsd.no/nsddata/serier/norske_valgundersokelser_eng.html. The UK W4 election panel dataset can be downloaded free of charge following agreeing to the terms of use at https://www.britishelectionstudy.com/data-objects/panel-study-data/. The Swedish election study data from 2010 can be applied for through the Swedish National Data Service at https://snd.gu.se/en/catalogue/study/snd0876#dataset.

Subsequent to the data being delivered, STATA do-files should be run in the following order:
1. gen_data.dta - gathers and merges all data from the raw source material (note that the file structure may differ from ours, so the code will probably need some minor changes),
2. VU.dta, BES.dta, DES.dta and NES.dta - runs robustness results for the Appendix for four different survey sources and stores the estimates,
3. analysis_part1.do loads the dataset gathered in gen_data.dta, runs the models, and stores all model information,
4. analysis_part2.do performs all final meta-analyses and prepares the main graphs and tables.

Since obtaining the data is a time consuming and expensive procedure, we also provide a second way of replicating the results. This is done by downloading all data (.dta) files listed below from the Dataverse and simply running analysis_part2.do, which takes the intermediate level data files output by the previous step. Note that it is necessary to download the data files in their original .dta format instead of as .tab files for this procedure to run. Additionally, remember to change the initial directory in the code to the directory where you have stored the replication materials. When running, this step will take the aggregated model results, do the meta-analyses, and prepare output in the form of tables and graphs, without requiring access to the raw register data.



The full replication package contains the following code and data files:

FILE			DESCRIPTION
analysis_part1.do	Loads raw data gathered in gen_data.dta
			and runs all basic models. (STATA code)

analysis_part2.do	Loads output from analysis_part2
			(finaldata.dta and matrices.dta), runs all
			meta-analyses based on basic model output,
			runs robustness checks with external surveys
			(input from BES_est.dta, DES_est.dta,
			NES_est.dta, VU_est.dta), and produces
			all graphs and tables. (STATA code)

BES.do			Runs robustness checks with British
			Election Survey. (STATA code)

BES_est.dta		Model output from British Election Survey
			analysis, subsequently used in meta-analysis.
			(STATA data file)

DES.do			Runs robustness checks with Danish
			Election Survey. (STATA code)

DES_est.dta		Model output from Danish Election Survey
			analysis, subsequently used in meta-analysis.
			(STATA data file)

finaldata.dta		Final dataset output by analysis_part1.do, used
			to perform meta-analysis in analysis_part2.do.
			(STATA data file)

finaldata_alt.dta	Alternative final dataset output by analysis_part1.do,
			with a reduced set of controls used. This data is only used
			to produce Table 6 in Appendix B (table_main_alt.tex).
			(STATA data file)

gen_data.do		Constructs raw individual level dataset from
			register sources (requires access to data from
			Statistics Sweden and the Swedish Twin Register).
			(STATA code)

matrices.dta		Contains correlation matrices of the outcome
			space derived in analysis_part1.do. Necessary
			to calculate standard errors for meta-analytical
			estimates in analysis_part2.do. (STATA data file)

NES.do			Runs robustness checks with Norwegian
			Election Survey. (STATA code)

NES_est.dta		Model output from Norwegian Election Survey
			analysis, subsequently used in meta-analysis.
			(STATA data file)

README.txt		This file.

VU.do			Runs robustness checks with Swedish
			Election Survey. (STATA code)

VU_est.dta		Model output from Swedish Election Survey
			analysis, subsequently used in meta-analysis.
			(STATA data file)



The output with corresponding figures and tables in the manuscript and appendix is listed below:

figure1.pdf			Figure 1, main text
figure2.pdf			Figure 2, main text
figure3.pdf			Figure 3, main text
figure4.pdf			Figure 4, main text

desc_dependent.tex		Table 1, online appendix
desc_independent.tex		Table 2, online appendix
dim1.tex			Table 7, online appendix
dim2.tex			Table 8, online appendix
dim3.tex			Table 9, online appendix
dim4.tex			Table 10, online appendix
dim5.tex			Table 11, online appendix
table_bs.tex			Table 5, online appendix
table_comb_BES.tex		Table 16, online appendix
table_comb_DES.tex		Table 15, online appendix
table_comb_NES.tex		Table 14, online appendix
table_comb_VU.tex		Table 13, online appendix
table_contact.tex		Table 12, online appendix
table_main.tex			Table 3, online appendix
table_main_alt.tex		Table 6, online appendix
table_wc.tex			Table 4, online appendix

altruism.pdf			Figure 21, online appendix
pcurve_altruism.pdf		Figure 22, online appendix
antisocial.pdf			Figure 19, online appendix
pcurve_antisocial.pdf		Figure 20, online appendix
bin_edu.pdf			Figure 3, online appendix
pcurve_bin_edu.pdf		Figure 4, online appendix
education_years.pdf		Figure 1, online appendix
pcurve_education_years.pdf	Figure 2, online appendix
extraversion_SALTY.pdf		Figure 13, online appendix
pcurve_extraversion_SALTY.pdf	Figure 14, online appendix
income10_tr.pdf			Figure 9, online appendix
pcurve_income10_tr.pdf		Figure 10, online appendix
LOC_SALTY.pdf			Figure 15, online appendix
pcurve_LOC_SALTY.pdf		Figure 16, online appendix
risk_preference.pdf		Figure 17, online appendix
pcurve_risk_preference.pdf	Figure 18, online appendix
stdIQ.pdf			Figure 25, online appendix
pcurve_stdIQ.pdf		Figure 26, online appendix
trust.pdf			Figure 11, online appendix
pcurve_trust.pdf		Figure 12, online appendix
utilitarian.pdf			Figure 23, online appendix
pcurve_utilitarian.pdf		Figure 24, online appendix
wealth_IHS.pdf			Figure 5, online appendix
pcurve_wealth_IHS.pdf		Figure 6, online appendix
wealth_net_IHS.pdf		Figure 7, online appendix
pcurve_wealth_net_IHS.pdf	Figure 8, online appendix
